package cn.hairui.blog.dao;

import cn.hairui.blog.entity.Likerecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 点赞记录表 Mapper 接口
 * </p>
 *
 * @author laoganbu
 * @since 2020-04-28
 */
@Mapper
public interface LikerecordMapper extends BaseMapper<Likerecord> {

    @Select("select count(1) from likerecord where artical_id=#{id}")
    int countLikeRecord(int id);

    @Select("select * from likerecord where artical_id=#{id} and ip_address=#{ipAddress}")
    Likerecord selectByIpAndArticalId(String ipAddress, int id);
}
